using System;
using System.Threading;

namespace Microsoft.Coding4Fun.TweetCraft.Tests.Support.Mocks
{

	/// <summary>
	/// MockAsyncResult
	/// </summary>
	internal class MockAsyncResult : IAsyncResult
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="MockAsyncResult"/> class.
		/// </summary>
		public MockAsyncResult()
		{
			AsyncWaitHandle = new ManualResetEvent(false);
			CompletedSynchronously = false;
			IsCompleted = false;
		}

		/// <summary>
		/// Gets a value that indicates whether the asynchronous operation has completed.
		/// </summary>
		/// <returns>
		/// true if the operation is complete; otherwise, false.
		/// </returns>
		public bool IsCompleted { get; private set; }

		/// <summary>
		/// Gets a <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
		/// </summary>
		/// <returns>
		/// A <see cref="T:System.Threading.WaitHandle"/> that is used to wait for an asynchronous operation to complete.
		/// </returns>
		public WaitHandle AsyncWaitHandle { get; private set; }

		/// <summary>
		/// Gets a user-defined object that qualifies or contains information about an asynchronous operation.
		/// </summary>
		/// <returns>
		/// A user-defined object that qualifies or contains information about an asynchronous operation.
		/// </returns>
		public object AsyncState { get; set; }

		/// <summary>
		/// Gets a value that indicates whether the asynchronous operation completed synchronously.
		/// </summary>
		/// <returns>
		/// true if the asynchronous operation completed synchronously; otherwise, false.
		/// </returns>
		public bool CompletedSynchronously { get; private set; }
	}
}